package com.example.hcbmsm.controller;

import com.example.hcbmsm.domain.Sn;
import com.example.hcbmsm.service.SnService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @author Xinghm
 * @version 1.0
 * @since 2024/10/30 19:09
 */
@RestController
@CrossOrigin
@RequestMapping("/sn")
public class SnController {
    @Autowired
    private SnService snService;
    @GetMapping("/list")
    public Map list(String token) {
        return snService.list(token);
    }
    @PostMapping("/add")
    public Map add(String token, @RequestBody Sn sn) {
        return snService.add(token, sn);
    }
    @PostMapping("/renew")
    public Map renew(@RequestBody Sn sn) {
        return snService.renew(sn);
    }
    @PostMapping("/remove")
    public Map remove(Long snId) {
        return snService.remove(snId);
    }
}
